Skip to content

Type-erase Quantity text conversion - #217

Merged
TurkeyMan merged 1 commit into
masterfrom
ow/quantity-text-footprint
Aug 20, 2026
Merged

TurkeyMan merged 1 commit into
masterfrom
ow/quantity-text-footprint

Conversation

@TurkeyMan

Copy link
Copy Markdown
Member

Summary

  • type-erase Quantity text formatting into floating-point and integral backends
  • type-erase parsing and runtime unit-scale conversion
  • preserve templated hard-unit arithmetic so compile-time units and scale factors still fold
  • format signed and unsigned integer quantities exactly instead of routing them through double

Why

Quantity!(T, unit) previously instantiated the complete formatting, parsing, and dynamic scale-conversion machinery for each representation and unit. These are cold runtime operations and gain nothing from hard-unit specialization. Thin typed adapters now pass the value and unit into shared backends, while arithmetic between hard units remains specialized.

An isolated SmartEVSE ESP32 release A/B build reduced the linked image by 416 bytes. That firmware emits only one Quantity formatter and three parsers, so targets using more Quantity text instantiations should gain more deduplication.

Validation

  • uRT Windows unittest configuration builds successfully
  • focused urt.si.quantity suite passes, including hard-unit arithmetic, scaled integer round-trip, long.min, values beyond exact double precision, and ulong.max
  • SmartEVSE ESP32 firmware links successfully; its existing partition-size check still fails after producing the image
  • git diff --check passes

@TurkeyMan
TurkeyMan force-pushed the ow/quantity-text-footprint branch from 454ae87 to 4a76109 Compare August 16, 2026 01:41
@TurkeyMan
TurkeyMan force-pushed the ow/quantity-text-footprint branch from 4a76109 to 8fe09fa Compare August 20, 2026 16:19
@TurkeyMan
TurkeyMan marked this pull request as ready for review August 20, 2026 16:26
@TurkeyMan
TurkeyMan merged commit f805cc9 into master Aug 20, 2026
20 checks passed
@TurkeyMan
TurkeyMan deleted the ow/quantity-text-footprint branch August 20, 2026 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant